package com.emperor.receipt.logic;

import java.util.ArrayList;
import java.util.List;

import com.emperor.core.logic.BizModelBase;
import com.emperor.customer.logic.Customer;

public class ReceiptModel extends BizModelBase implements Receipt {

	private Long id;
	private String code;
	private Long codeid;
	private Customer customer;
	private Double total;
	private Double paid;
	private Double change;
	private String paymethod;
	private String custname;
	private String status;

	public Long getId() {
		return id;
	}

	public void setId(Object id) {
		if (id != null) {
			if (id instanceof Long) {
				this.id = (Long) id;
			} else {
				try {
					this.id = new Long(id.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Object customer) {
		if (customer != null) {
			if (customer instanceof Customer) {
				this.customer = (Customer) customer;
			}
		}
	}

	public Double getTotal() {
		return total;
	}

	public void setTotal(Object total) {
		if (total != null) {
			if (total instanceof Double) {
				this.total = (Double) total;
			} else {
				try {
					this.total = new Double(total.toString());
				} catch (Exception e) {
				}
			}
		}
	}
	
	public String getStatus() {
		return status;
	}

	public void setStatus(Object status) {
		if (status != null) {
			if (status instanceof String) {
				this.status = (String) status;
			} else {
				try {
					this.status = status.toString();
				} catch (Exception e) {
				}
			}
		}
	}
	
	public List<String> getFieldNames() {
		List<String> fieldNames = new ArrayList<String>();
		
		fieldNames.add(FLD_ID);
		fieldNames.add(FLD_CODE);
		fieldNames.add(FLD_CODEID);
		fieldNames.add(FLD_CUSTOMER);
		fieldNames.add(FLD_TOTAL);
		fieldNames.add(FLD_PAID);
		fieldNames.add(FLD_CHANGE);
		fieldNames.add(FLD_PAYMETHOD);
		fieldNames.add(FLD_CUSTNAME);
		
		fieldNames.add(FLD_CRTBY);
		fieldNames.add(FLD_CRTDATE);
		fieldNames.add(FLD_UPDBY);
		fieldNames.add(FLD_UPDDATE);
		
		return fieldNames;
	}

	public Double getPaid() {
		return paid;
	}

	public void setPaid(Object paid) {
		if (paid != null) {
			if (paid instanceof Double) {
				this.paid = (Double) paid;
			} else {
				try {
					this.paid = new Double(paid.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public Double getChange() {
		return change;
	}

	public void setChange(Object change) {
		if (change != null) {
			if (change instanceof Double) {
				this.change = (Double) change;
			} else {
				try {
					this.change = new Double(change.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public String getPaymethod() {
		return paymethod;
	}

	public void setPaymethod(Object paymethod) {
		if (paymethod != null) {
			if (paymethod instanceof String) {
				this.paymethod = (String) paymethod;
			} else {
				try {
					this.paymethod = paymethod.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getCode() {
		return code;
	}

	public void setCode(Object code) {
		if (code != null) {
			if (code instanceof String) {
				this.code = (String) code;
			} else {
				try {
					this.code = code.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public Long getCodeid() {
		return codeid;
	}

	public void setCodeid(Object codeid) {
		if (codeid != null) {
			if (codeid instanceof Long) {
				this.codeid = (Long) codeid;
			} else {
				try {
					this.codeid = new Long(codeid.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public String getCustname() {
		return custname;
	}

	public void setCustname(Object custname) {
		if (custname != null) {
			if (custname instanceof String) {
				this.custname = (String) custname;
			} else {
				try {
					this.custname = custname.toString();
				} catch (Exception e) {
				}
			}
		}
	}
	
}
